package main

import (
	"fmt"
	"unsafe"
)

func app(ss []int ) []int {
	ss = append(ss, 55, 66)
	return ss
}

var ss = []int{1, 2, 3}

type MyStruct struct {
	i, j int
}

func demo(i *int)  {
	fmt.Println(i)
}

func main() {
	//a := 1
	//demo(&a)
	//ss = append(ss, 33, 44)
	//ss = app(ss)
	//fmt.Println(ss)
	//
	//var s = make([]string, 10)
	//s = append(s, "aaa")
	//fmt.Println(s)
	//
	//ret := test()
	//fmt.Println(ret)
	//
	//x := make([]int, 0, 10)
	//x = append(x, 1, 2, 3)
	//y := append(x,4)
	//z := append(x, 5)
	//fmt.Println(x, y, z)

	a1 := &MyStruct{i:40,j:50}
	myFunc(a1)
	fmt.Println(a1.i, a1.j)
}

func myFunc(ms *MyStruct)  {
	ptr := unsafe.Pointer(ms)
	for i := 0; i < 2; i++ {
		aa := uintptr(ptr)
		bb := uintptr(8*i)
		c := (*int)(unsafe.Pointer((aa + bb)))
		*c += i + 1
	}
}
func test() string {
	defer func() {
		recover()
	}()
	panic("demo")
	return "10999"
}